import axios from 'axios'
import { Toast } from 'vant'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'

const http = axios.create({
  baseURL: 'http://10.41.153.39:3300'
  // baseURL: 'http://127.0.0.1:3300'
})

http.interceptors.request.use(request => {
  NProgress.start()
  return request
}, err => {
  // 弹窗
  Toast(err)
})

http.interceptors.response.use(response => {
  NProgress.done()
  return response
}, err => {
  // 弹窗
  Toast(err)
})

export default http
